<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Ajax extends CI_Controller {
	function getProvince()
	{
		$pid    = _uk(3);
		$this->db->from('areas');
		$this->db->where('reid', 0);
		//$this->db->order_by('id', 'desc');
		$query	= $this->db->get();
		$options    = '<option value="">不限</option>';
		foreach ($query->result() as $row)
		{
			if ($pid != 0 && $pid == $row->id)
			{
				$options    .= "<option value='".$row->id."' selected >".$row->name."</option>";
			}
			else
			{
				$options    .= "<option value='".$row->id."'>".$row->name."</option>";
			}
		}
		die($options);
	}
	function getCity()
	{
		$pid    = _uk(3);
		$cid    = _uk(4);
		$this->db->select('id,name');
		$this->db->from('areas');
		$this->db->where('reid', $pid);
		$query  = $this->db->get();
		$options    = '';
		if ($query && $query->num_rows() > 0)
		{
			foreach ($query->result() as $row)
			{
				if ($cid !=0 && $cid == $row->id)
				{
					$options    .= "<option value='".$row->id."' selected>".$row->name."</option>";
				}
				else
				{
					$options    .= "<option value='".$row->id."'>".$row->name."</option>";
				}
			}
		}
		else
		{
			$options    = '<option value="">其他</option>';
		}
		die($options);
	}
	function checkDomain()
	{
		$domain	= _uk(3);
		$this->db->from('customer');
		$this->db->where('domain', $domain);
		$this->db->where('flag >' , -2);
		$query  = $this->db->get();
		if ($query && $query->num_rows() > 0)
		{
			die('OK');
		}
		else 
		{
			die("ERR");
		}
	}
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */